﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using HGZP.BLL;
using HGZP.DAL;
using HGZP.Model;
using System.Data;

namespace SZCB.admin.SealManager
{
    public partial class SealEnterprise : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                ViewState["wheresql"] = "";
                GetContentCount();
                BindContentData();

            }

        }

        #region 绑定内容表单()
        private void GetContentCount()
        {
            string sql = " ";
            if (ViewState["wheresql"] != null)
                sql += ViewState["wheresql"].ToString();
            CSealEnterpriseBLL myCSealEnterpriseBLL = new CSealEnterpriseBLL();
            returnDataPager.RecordCount = myCSealEnterpriseBLL.F09_GetCount(sql);
        }
        private void BindContentData()
        {
            string sql = " ";
            if (ViewState["wheresql"] != null)
                sql += ViewState["wheresql"].ToString();
            CSealEnterpriseBLL myCSealEnterpriseBLL = new CSealEnterpriseBLL();
            RptData.DataSource = myCSealEnterpriseBLL.F08_SelectColumnHaveWhereOrder_OnePage(returnDataPager.StartRecordIndex - 1, returnDataPager.PageSize, "*", sql, myCSealEnterpriseBLL.dCreateDate + " DESC");
            RptData.DataBind();
        }
        protected void ReturnDataPagerPageChanged(object sender, EventArgs e)
        {
            BindContentData();
        }
        #endregion

        protected void RptData_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Literal lit = e.Item.FindControl("Literal1") as Literal;//分类名
                DataRowView rowv = (DataRowView)e.Item.DataItem;//找到分类Repeater关联的数据项 
                if (Convert.ToInt32(rowv["nSealType"].ToString()) == 0)
                {
                    lit.Text = "实体店";
                }
                else
                {
                    lit.Text = "网络商店";

                }
            }
        }

    }
}